Buffer state refactor with viewport sync and UI improvements#14
Merged
TimelordUK merged 7 commits intomainfrom Aug 29, 2025
Merged
Buffer state refactor with viewport sync and UI improvements#14TimelordUK merged 7 commits intomainfrom
TimelordUK merged 7 commits intomainfrom
Conversation
- Created ViewState struct in Buffer to consolidate all view-related state - Implemented proxy pattern (NavigationProxy, SelectionProxy) for state access - Buffer now owns all its view state (crosshair, scroll, selection, viewport locks) - State automatically preserved when switching buffers - Fixed Ctrl-6 buffer switching to work in Results mode - Updated help text to clarify buffer switching works in both modes - Moved documentation files to docs/ folder for better organization - Added comprehensive tests for buffer state preservation This eliminates state duplication between ViewportManager, NavigationState, SelectionState, and Buffer. Each buffer's view state now travels with it, fixing synchronization bugs when switching buffers. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
- Added TabBarWidget that displays all open buffers as tabs - Shows Alt+N keyboard shortcuts (1:name, 2:name, etc) - Highlights the currently selected buffer - Auto-hides when only one buffer is open (no wasted space) - Integrates seamlessly with existing layout - Inspired by neovim/vim tab plugins for familiar UX The tab bar provides visual feedback for buffer state and makes it easy to see which buffers are open and quickly switch between them using Alt+1-9 shortcuts. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
- Add ViewportManager sync when switching between buffers - Ensure viewport properly updates DataView on buffer switch - Add visual tab bar showing all open buffers (like neovim) - Fix tab bar to always show for consistent layout (even with 1 buffer) - Simplify status line to avoid redundancy (remove duplicate filenames) - Fix Ctrl-6 quick switch to work in Results mode - Add tests for buffer state preservation The ViewportManager now correctly updates when switching buffers, showing the proper data for each buffer. Tab bar provides visual feedback for open buffers with Alt+N shortcuts. 🤖 Generated with Claude Code Co-Authored-By: Claude <noreply@anthropic.com>
- Add 'start_mode' option to BehaviorConfig (command or results) - Default to 'results' mode for immediate data viewing - Apply configured mode when loading CSV/JSON files - Update config file generation with new option and documentation Users can now configure whether to start in command mode (focus on SQL input) or results mode (focus on data). This addresses the common preference of wanting to immediately see data when loading files. Config option: [behavior] start_mode = "results" # or "command" 🤖 Generated with Claude Code Co-Authored-By: Claude <noreply@anthropic.com>
- Fix test_viewport_buffer_sync.rs to use correct DataTable API - DataTable::new() now requires a name parameter - Use add_column() and DataRow::new() for proper table construction - Replace headers() with column_names() method calls - Add comprehensive pin columns feature analysis document All tests now pass successfully. Pin columns feature is ~70% ready with the main remaining work in viewport/rendering layer. 🤖 Generated with Claude Code Co-Authored-By: Claude <noreply@anthropic.com>
- Fix get_selected_row() to use table_state.selected() for backward compatibility - This maintains the old API behavior where None means no selection - Update test_direct_buffer_viewstate_access to properly sync state - All tests now pass successfully 🤖 Generated with Claude Code Co-Authored-By: Claude <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Key Changes
Buffer State Refactor
Viewport & Buffer Switching
UI Improvements
Configuration
start_modeconfig option to choose initial mode when loading filesTesting
Next Steps
With this improved architecture, we can now revisit the pin columns feature which was previously problematic due to state duplication issues.
🤖 Generated with Claude Code